﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using RomaClient.RomaReference;
using RomaClient.Models;

namespace RomaClient.Controllers
{
    public class UserController : Controller
    {
        private RoMaWSClient proxy = new RoMaWSClient();

        //
        // GET: /User/

        public ActionResult Index()
        {
            ProfileModel pm = new ProfileModel();
            userUI user = (userUI)Session["user"];
            pm.Friends = proxy.getUserFriends(user.id);
            pm.FriendsUpdates = proxy.getFriendStatusUpdates(user.id);
            return View(pm);
        }

        [HttpPost]
        public PartialViewResult Search(string q)
        {
            var users = proxy.searchAfterUser(q);

            return PartialView("_SearchUserResult", users);
        }

        public ActionResult Details(int id)
        {
            return View();
        }


        public ActionResult FindUser()
        {
            return View();
        }


        public ActionResult Interests()
        {
            userUI user = (userUI)Session["user"];
            interestUI[] model = proxy.getUserInterests(user.id);
            return View(model);
        }

        [HttpGet]
        public ActionResult AddInterest()
        {
            return View();
        }

        [HttpPost]
        public ActionResult AddInterest(string name)
        {
            userUI user = (userUI)Session["user"];
            proxy.addInterest(user.id, name);
            return View();
        }

        public ActionResult Wall()
        {
            userUI user = (userUI)Session["user"];
            statusUI[] model = proxy.getStatusUpdates(user.id);
            return View(model);
        }

    }
}
